using System;
using System.Collections.Generic;
using System.Text;

using OOFluidFramework.Operators;
using OOFluidFramework.Utility;

namespace OOFluidFramework.Orders
{
    class ParticleOrderImpl : FluidOrderImpl, ParticleOrder
    {
        List<LagrangianOperator> opList;
        GridArrangeOrder ordGrid; //Note, that this is only designed for single - thread program.
                                  //Consider multi-thread, ordGrid is a critical section.
        public int Register(LagrangianOperator op)
        {
            opList.Add(op);
            return opList.Count;
        }
        public void CastRetrive(Delimiter Range)
        {
            foreach (LagrangianOperator op in opList)
            {
                op.RetriveVelocity(ordGrid, range);
            }
        }
        public void CastMove()
        {
            foreach (LagrangianOperator op in opList)
            {
                op.Move();
            }
        }
        public void CastEmit(Delimiter Range)
        {
            foreach (LagrangianOperator op in opList)
            {
                op.EmitVelocity(ordGrid, Range);
            }
        }

        public GridArrangeOrder ord
        {
            get
            {
                return ordGrid;
            }
            set
            {
                ordGrid = value;
            }
        }
    }

    interface ParticleOrder
    {
        int Register(LagrangianOperator op);
        void CastRetrive(Delimiter range);
        void CastMove();
        void CastEmit(Delimiter range); 
        int ParticleCount
        {
            get;
        }
        GridArrangeOrder ord
        {
            get;
            set;
        }
    }
}

